class Solution {
public:
    string formatString(string str, vector<char>& arg)
    {
        int k = 0;
        string ret;
        auto it = str.begin();
        while (it != str.end())
        {
            if (*it == '%' && *(it + 1) == 's')
            {
                ret += arg[k++];
                it += 2;
            }
            else
            {
                ret += *it;
                it++;
            }
        }
        while (k != arg.size())
        {
            ret += arg[k++];
        }
        return ret;
    }
};